package spider;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

public class Test {
    public static void main(String[] args) {
        String html = HTTPUtil.httpPost("https://www.bookuu.com/search.php?cid=101803", "", "utf-8");
        Document document = Jsoup.parse(html);
        Elements ul = document.select("ul.search-tab-content");
        Elements divs = ul.select("div.wd-940");
        for (Element div : divs) {
            Elements wd640 = div.select(".wd-640");
            Elements a = wd640.select("a:eq(0)");
            System.out.println("标题=" + a.text());
            System.out.println("详情："+a.attr("href"));
            Elements money = wd640.select(".lh-30");
            //System.out.println(money.html());
            System.out.println("----------------------");
            System.out.println("销售价：" + money.select(".fs-21").text());
            System.out.println("原价：" + money.select("del").text());
            Elements author = wd640.select("div.lh-30.fs-12");
            String name = author.select("a.hover").text();
            System.out.println("作者：" + name.split("\\|")[0]);
        }
    }
}
